package com.situ.day06;

import java.util.Scanner;

public class TestRetangle {
	public static void main(String[] args) {
		System.out.println("请选择参数要求：");
		System.out.println("##############");
		System.out.println("1为无参");
		System.out.println("2为1个参数");
		System.out.println("3为两个参数");
		System.out.println("##############");
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		
		switch (count) {
		case 1:
			Retangle retangle1 = new Retangle();
			System.out.println("面积为："+retangle1.area(retangle1.getWidth(), retangle1.getHigh()));
			System.out.println("周长为："+retangle1.perimeter(retangle1.getHigh(), retangle1.getWidth()));
			break;
		case 2:
			System.out.println("输入长或宽");
			int width = scanner.nextInt();
			Retangle retangle2 = new Retangle(width);
			System.out.println("面积为："+retangle2.area(retangle2.getWidth(), retangle2.getHigh()));
			System.out.println("周长为："+retangle2.perimeter(retangle2.getHigh(), retangle2.getWidth()));
			break;

		case 3:
			System.out.println("输入长和宽");
			int width1 = scanner.nextInt();
			int high1 = scanner.nextInt();
			Retangle retangle3 = new Retangle(width1, high1);
			System.out.println("面积为："+retangle3.area(retangle3.getWidth(), retangle3.getHigh()));
			System.out.println("周长为："+retangle3.perimeter(retangle3.getHigh(), retangle3.getWidth()));
			break;
		}
		
	}
}
